package ccpc_2023;

import java.io.*;
import java.util.*;

public class E {
    public static void main(String[] args) {
        FastReader reader = new FastReader();
        int n = reader.nextInt();
        int[] arr = new int[1024 * 1024 + 5];
        for (int i = 0; i <= 1024 * 1024; i++) {
            int temp = 0;
            int x = i;
            while (x != 0) {
                temp += x & 1;
                x >>= 1;
            }
            arr[i] = temp;
        }
        boolean flag;
        for (int i = 0; i < n; i++) {
            reader.nextInt();
            int k = reader.nextInt();
            char[] str = reader.next().toCharArray();
            flag = true;
            int y = 0;
            for (char j : str) if (j == '1') y++;
            for (int j = 0; j <= 20; j++) {
                if (arr[(y + j) % (int) Math.pow(2, k)] == j) {
                    String ans = Integer.toBinaryString((y + j) % (int) Math.pow(2, k));
                    for (int l = 0; l < k - ans.length(); l++) System.out.print("0");
                    System.out.println(ans);
                    flag = false;
                    break;
                }
            }
            if (flag) System.out.println("None");
        }
        System.out.flush();
    }

    // FastReader class for fast input
    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
            st = null;
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }
    }
}